let h = `

<div class="content"><span>@统一阿萨姆：</span>
<p><strong>张明明</strong> 擅长话题：宅</p>
<blockquote>
<p>首先你得要有……</p>
<p>哎？谁邀请我答这题的？几个意思？</p>
</blockquote>
<hr><p><strong>Robin</strong> 篮球爱走步 游泳会狗刨</p>
<blockquote>
<p>我和女朋友说先救她，她说就我狗刨水平滚一边去，别挡着她老公宁泽涛用蛙泳蝶泳自由泳花式泳姿救她了。</p>
</blockquote>
<hr><p><strong>王 x</strong> 统计学烟酒僧</p>
<blockquote>
<p>恭喜你，发生这种极端事件的概率低于 0.4%。所以不管救谁，救完之后一定记得要买彩票。</p>
</blockquote>
<hr><p><strong>匿名用户</strong></p>
<blockquote>
<p>先把妈救了，然后静静地等河神到来。</p>
<p>河神：这个胸大的是你的吗？</p>
<p>河神：这个腿长的是你的吗？</p>
<p>河神：这个颜美的是你的吗？</p>
<p>……</p>
<p>（怕女友发现，匿了。）</p>
</blockquote>
<hr><p>嫌脑洞还不够大？还是买瓶阿萨姆奶茶，扫描二维码，让周星星和郭采洁的「神回复」助你分分钟脑洞大开，让你笑到失声，笑到癫狂，分分钟 get 满满好心情！</p>
<p><strong id="docs-internal-guid-e1488b05-3c76-d270-6638-bad9319c3f7e"><a href="http://asm.pec.com.cn/1.do?l=Q5">点这里，听听看</a>。</strong></p>
</div>

`;


// console.log(h);
console.log('\n********************************************************************\n');

// 把html标签替换成markdown标签
h = h.replace(/<sup>.*?<\/sup>/g, '$1');
h = h.replace(/<pre><code.*?>([\s\S]*?)<\/code><\/pre>/g, '```\r\n$1\r\n```');
h = h.replace(/<span class="LinkCard-content">.*?<\/span>/g, '');
h = h.replace(/<span class="invisible">.*?<\/span>/g, '');
h = h.replace(/<span class="visible">(.*?)<\/span>/g, '$1');
h = h.replace(/<div class="ZhihuDaily-AuthorLine"><span class="ZhihuDaily-Author">.+?<\/span>/, '@知乎用户');
h = h.replace(/<span class=".*?"><\/span>/, '');
h = h.replace(/<a class="view-more" href=".*?">进入「知乎」查看相关讨论<\/a>/, '');
h = h.replace(/<noscript>(.*?)<\/noscript>/g, '');
h = h.replace(/<blockquote>([\s\S]*?)<\/blockquote>/g, function (item, a) {
  let result = '';
  a = a.split('<br>');
  for (let i = 0; i < a.length; i++) {
    let b = a[i].split('\n');
    for (let j = 0; j < b.length; j++) {
      if (b[j].trim().length > 0) {
        result += '> ' + b[j].trim() + '\r\n';
      }
    }
  }
  return result;
});
h = h.replace(/<ul>([\s\S]*?)<\/ul>/g, function (item, a) {
  return a.replace(/<li>([\s\S]*?)<\/li>/g, function (sub_item, sub_a) {
    return '- ' + sub_a.trim();
  });
});
h = h.replace(/<ol>([\s\S]*?)<\/ol>/g, function (item, a) {
  return a.replace(/<li>([\s\S]*?)<\/li>/g, function (sub_item, sub_a) {
    return '- ' + sub_a.trim();
  });
});
h = h.replace(/<h2 class="question-title">(.+)<\/h2>/, '### $1');
h = h.replace(/> <p>(.+?)<\/p>/g, '> $1');
h = h.replace(/<p.*?>([\s\S]*?)<\/p>/g, '\r\n$1\r\n');
h = h.replace(/<span.*?>(.*?)<\/span>/g, '$1');
h = h.replace(/<figure.*?><img.*?src="(.*?)".*?><\/figure>/g, '\r\n![]($1)\r\n');
h = h.replace(/<img.*?src="(.*?)".*?>/g, '\r\n![]($1)\r\n');
h = h.replace(/<a.*?href="(.*?)".*?>(.*?)<\/a>/g, '[$2]($1)');
h = h.replace(/<b>(.*?)<\/b>/g, '**$1**');
h = h.replace(/<strong><em>\s*(.*?)\s*<\/em><\/strong>/g, ' ***$1*** ');
h = h.replace(/<em>(.*?)<\/em>/g, ' *$1* ');
h = h.replace(/<strong.*?>\s*(.*?)\s*<\/strong>/g, ' **$1** ');
h = h.replace(/<strong.*?>(.*?)<\/strong>/g, '$1');
h = h.replace(/<strong.*?>(.*?)<\/strong>/g, '$1');
h = h.replace(/<br.*?>/g, '\r\n');
h = h.replace(/<h1>(.*?)<\/h1>/g, '### $1');
h = h.replace(/<h2>(.*?)<\/h2>/g, '### $1');
h = h.replace(/<h3>(.*?)<\/h3>/g, '### $1');
h = h.replace(/<u>(.*?)<\/u>/g, '$1');
h = h.replace(/<i>\s*(.*?)\s*<\/i>/g, ' ***$1*** ');
h = h.replace(/<address>(.*?)<\/address>/g, '$1');
h = h.replace(/___/, '\\___');
h = h.replace(/---/, '\\---');

// 以下是去掉无用的内容
h = h.replace(/<hr>/g, '');
h = h.replace(/<div class="meta">[\s\S]*?<\/div>/gim, '');
h = h.replace(/<div class="answer".*?>/, '');
h = h.replace(/<div class="answer".*?>/g, '&nbsp;');
h = h.replace(/<div class="(.*?)".*?>/g, '');
h = h.replace(/<div id="(.*?)">.*?/g, '');
h = h.replace(/<div>/g, '');
h = h.replace(/<\/div>/g, '');
h = h.replace(/<\/span>/g, '');
h = h.replace(/<\/a>/g, '');
h = h.replace(/<figure><\/figure>/g, '');
h = h.replace(/<iframe.*?>.*?<\/iframe>/g, '');
h = h.replace(/<wbr>/g, '');


console.log(h);





















